package cn.hp.cms.servlet.user;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;

@WebServlet("/user/userPage.do")
public class UserPageServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String page = req.getParameter("page");
        try {
            UserPageServlet.class.getDeclaredMethod(page, HttpServletRequest.class, HttpServletResponse.class).invoke(this,req,resp);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }

    public void updateImg(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        跳转到修改头像页面
        req.getRequestDispatcher("/WEB-INF/user/updateImg.html").forward(req,resp);
    }
}
